package com.gzs.learn.payment.api.controller;

import com.gzs.learn.inf.BaseResponseDto;
import com.gzs.learn.payment.inf.dto.UnifyPayment;
import com.gzs.learn.payment.inf.dto.UnifyQuery;
import com.gzs.learn.payment.inf.dto.UnifyRefund;
import com.gzs.learn.payment.inf.dto.UnifyRefundQuery;
import com.gzs.learn.payment.service.IPaymentQueryService;
import com.gzs.learn.payment.service.IPaymentService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhisong.guan
 */
@RestController
@RequestMapping("/payment")
@RequiredArgsConstructor
public class PaymentController {
    private final IPaymentService paymentService;

    private final IPaymentQueryService paymentQueryService;

    @PostMapping("unify-payment")
    public BaseResponseDto<?> unifyPayment(@RequestBody UnifyPayment unifyPayment) {
        return paymentService.unifyPayment(unifyPayment);
    }

    @PostMapping("unify-refund")
    public BaseResponseDto<?> unifyRefund(@RequestBody UnifyRefund unifyRefund) {
        return paymentService.unifyRefund(unifyRefund);
    }

    @PostMapping("unify-payment-query")
    public BaseResponseDto<?> unifyPaymentQuery(@RequestBody UnifyQuery unifyQuery) {
        return paymentQueryService.unifyQuery(unifyQuery);
    }

    @PostMapping("unify-refund-query")
    public BaseResponseDto<?> unifyRefundQuery(@RequestBody UnifyRefundQuery unifyRefundQuery) {
        return paymentQueryService.unifyRefundQuery(unifyRefundQuery);
    }
}
